package org.raymond.iworks.study.netty.atguigu.netty.buf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.extern.slf4j.Slf4j;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
@Slf4j
public class NettyByteBuf01 {
    public static void main(String[] args) {
        int size = 10;
        ByteBuf buf = Unpooled.buffer(size);
        for(int i=0; i<size; i++){
            buf.writeByte(i);
        }

        log.info("capacity: {}", buf.capacity());
        for(int i=0; i<buf.capacity(); i++){
            log.info("out: {}", buf.readByte());
        }

        buf.clear();
        for(int i=0; i<buf.capacity(); i++){
            log.info("out: {}", buf.readByte());
        }
    }
}
